package com.co.gateway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import reactor.core.publisher.Mono;

/**
 * @author ldl.plus
 * @date 2020年06月25日  11:04
 */
@SpringBootApplication
@EnableEurekaClient
public class WebGatewayApplication11001 {
    public static void main(String[] args) {
        SpringApplication.run(WebGatewayApplication11001.class, args);
    }

    @Bean("ipKeyResolver")
    public KeyResolver userKeyResolver() {
        return exchange -> Mono.just(exchange.getRequest().getRemoteAddress().getHostString());
    }
}
